// 导入axios实例
import httpRequest from '../request/index';
// sha256加密
import sha256 from 'crypto-js/sha256';


// 开始采集
export function doCollect(data) {
    data['time'] = Math.round(new Date().getTime() / 1000);
    let params = `${data.cate}${data.urls.length}XpFaEDYkQH`;
    data['sign'] = sha256(params).toString().substring(0, 15);
    return httpRequest({
        timeout: 20000,
        baseURL: '/admin',
        url: '/collect',
        method: 'post',
        data: data,
        headers: { Authorization: `Bearer ${window.sessionStorage.getItem('token')}` }
    });
}